<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="author" content="演示SHOP Team">
	<meta name="copyright" content="演示SHOP">
	<title>${message("member.order.list")}[#if showPowered] - 演示电商[/#if]</title>
	<link href="${base}/favicon.ico" rel="icon">
	<link href="${base}/resources/common/css/bootstrap.css" rel="stylesheet">
	<link href="${base}/resources/common/css/font-awesome.css" rel="stylesheet">
	<link href="${base}/resources/common/css/iconfont.css" rel="stylesheet">
	<link href="${base}/resources/common/css/base.css" rel="stylesheet">
	<link href="${base}/resources/mobile/member/css/base.css" rel="stylesheet">
	<!--[if lt IE 9]>
		<script src="${base}/resources/common/js/html5shiv.js"></script>
		<script src="${base}/resources/common/js/respond.js"></script>
	<![endif]-->
	<script src="${base}/resources/common/js/jquery.js"></script>
	<script src="${base}/resources/common/js/bootstrap.js"></script>
	<script src="${base}/resources/common/js/bootstrap-growl.js"></script>
	<script src="${base}/resources/common/js/jquery.scrolltofixed.js"></script>
	<script src="${base}/resources/common/js/moment.js"></script>
	<script src="${base}/resources/common/js/jquery.cookie.js"></script>
	<script src="${base}/resources/common/js/scrollload.js"></script>
	<script src="${base}/resources/common/js/underscore.js"></script>
	<script src="${base}/resources/common/js/url.js"></script>
	<script src="${base}/resources/common/js/base.js"></script>
	<script src="${base}/resources/mobile/member/js/base.js"></script>
	<script id="scrollLoadTemplate" type="text/template">
		<%
		function statusText(status) {
		switch (status) {
		case "PENDING_PAYMENT":
		return "${message("Order.Status.PENDING_PAYMENT")}";
		case "PENDING_REVIEW":
		return "${message("Order.Status.PENDING_REVIEW")}";
		case "PENDING_SHIPMENT":
		return "${message("Order.Status.PENDING_SHIPMENT")}";
		case "SHIPPED":
		return "${message("Order.Status.SHIPPED")}";
		case "RECEIVED":
		return "${message("Order.Status.RECEIVED")}";
		case "COMPLETED":
		return "${message("Order.Status.COMPLETED")}";
		case "FAILED":
		return "${message("Order.Status.FAILED")}";
		case "CANCELED":
		return "${message("Order.Status.CANCELED")}";
		case "DENIED":
		return "${message("Order.Status.DENIED")}";
		case "AFTERPAID1":
		return "${message("Order.Status.AFTERPAID1")}";
		case "AFTERPAID2":
		return "${message("Order.Status.AFTERPAID2")}";
		case "AFTERPAID3":
		return "${message("Order.Status.AFTERPAID3")}";
		case "AFTERPAID4":
		return "${message("Order.Status.AFTERPAID4")}";
		}
		}
		%>

		<%_.each(data, function(order, i) {%>
			<div class="panel panel-default">
				<div class="panel-body">
					<div class="list-group">
						<%_.each(order.orderItems, function(orderItem, i) {%>
							<div class="list-group-item">
								<div class="media">
									<div class="panel-heading text-left">
										<ul>
											<li>
												<span class="text-gray-dark">${message("Order.sn")}: <%-order.sn%></span>
												<%if (order.hasExpired) {%>
												<span class="pull-right text-gray-dark">${message("member.order.hasExpired")}</span>
												<%} else {%>
													<%if (order.status == "PENDING_SHIPMENT" || order.status == "PENDING_REVIEW" || order.status == "PENDING_PAYMENT") {%>
													<strong class="text-orange pull-right"><%-statusText(order.status)%></strong>
													<%} else if (order.status == "FAILED" || order.status == "DENIED"){%>
													<strong class="text-red pull-right"><%-statusText(order.status)%></strong>
													<%} else if (order.status == "CANCELED"){%>
													<strong class="text-gray-dark pull-right"><%-statusText(order.status)%></strong>
													<%} else {%>
													<strong class="text-green pull-right"><%-statusText(order.status)%></strong>
													<%}%>
												<%}%>
											</li>

											<li>
												<span class="text-gray-dark">
													<i class="iconfont icon-shop"></i>
													<%if (order.store!==null) {%>
													<%-order.store.name%>
													<%}%>
												</span>

												<span title="<%-moment(new Date(order.createdDate)).format("YYYY-MM-DD HH:mm:ss")%>"><%-moment(new Date(order.createdDate)).format("YYYY-MM-DD HH:mm:ss")%></span>
											</li>
										</ul>
									</div>


									<div class="media-left media-middle">

										<%if (orderItem.sku !==null) {%>
											<a href="view?orderSn=<%-order.sn%>" target="_blank" title="<%-orderItem.name%>">
												<img class="media-object img-thumbnail" src="<%-orderItem.thumbnail != null ? orderItem.thumbnail : "${setting.defaultThumbnailProductImage}"%>" alt="<%-orderItem.name%>">
											</a>
										<%} else {%>
											<img class="media-object img-thumbnail" src="<%-orderItem.thumbnail != null ? orderItem.thumbnail : "${setting.defaultThumbnailProductImage}"%>" alt="<%-orderItem.name%>">
										 <%}%>

									</div>
									<div class="media-body media-middle">
										<h5 class="media-heading">
											<%if (orderItem.sku !==null) {%>
												<a href="view?orderSn=<%-order.sn%>" title="<%-orderItem.name%>"><%-orderItem.name%></a>
											<%} else {%>
											<%-orderItem.name%>
											<%}%>
										</h5>
										<%if (orderItem.specifications.length > 0) {%>
										<span class="small text-gray">[<%-orderItem.specifications.join(", ")%>]</span>
										<%}%>
										<p class="text-gray-dark"><%-$.currency(orderItem.price, true)%> &times; <%-orderItem.quantity%></p>

									</div>

								</div>
							</div>
						<%});%>
					</div>
				</div>
				<div class="panel-footer text-right">
					<a class="btn btn-default btn-sm" href="view?orderId=<%-order.id%>">${message("member.order.view")}</a>
					<%if (order.isReviewEnabled && !order.isReviewed &&(order.status == "RECEIVED" || order.status == "COMPLETED")) {%>
					<a class="btn btn-default btn-icon pull-right" href="${base}/member/review/add?orderId=<%-order.id%>" title="${message("member.order.review")}">
						<i class="iconfont icon-comment"></i>
					</a>
					<%}%>
					<%if (order.type == "GENERAL" &&(order.status == "RECEIVED" || order.status == "COMPLETED")) {%>
					<a class="btn btn-default btn-icon pull-right" href="${base}/member/aftersales/apply?orderId=<%-order.id%>" title="${message("member.order.aftersalesApply")}">
						<i class="iconfont icon-text"></i>
					</a>
					<%}%>
				</div>
			</div>
		<%});%>
	</script>

	[#noautoesc]
		[#escape x as x?js_string]
			<script>
			$().ready(function() {

			});
			</script>
		[/#escape]
	[/#noautoesc]
</head>
<body class="member">
	<header class="header-default" data-spy="scrollToFixed">
		<div class="container-fluid">
			<div class="row">
				<div class="col-xs-1">
					<a href="${base}/member/index">
						<i class="iconfont icon-back"></i>
					</a>
				</div>
				<div class="col-xs-10">
					<h5>${message("member.order.list")}</h5>
				</div>
			</div>
		</div>
	</header>
	<main>
		<div class="container-fluid">
			<div id="scrollLoad" data-spy="scrollLoad" data-url="${base}/member/orderplus/list?pageNumber=<%-pageNumber%>&status=${status}&hasExpired=${(hasExpired?string("true", "false"))!}">
				<div id="scrollLoadContent"></div>
			</div>
		</div>
	</main>
</body>
</html>